<template>
  <div>
    <h1>妈妈关怀推荐</h1>
    <el-table :data="momRecommendations" style="width: 100%">
      <el-table-column prop="productName" label="商品名称"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="viewProduct(scope.row.productId)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getMomCareRecommendations } from '@/api/recommendation';

export default {
  data() {
    return {
      momRecommendations: [],
    };
  },
  methods: {
    async fetchMomCareRecommendations() {
      const response = await getMomCareRecommendations();
      this.momRecommendations = response.data;
    },
    viewProduct(productId) {
      this.$router.push({ path: `/products/${productId}` });
    },
  },
  mounted() {
    this.fetchMomCareRecommendations();
  },
};
</script>

<style scoped>
.mom-care-recommendations {
  padding: 20px;
}
</style> 